package com.jinzheng.qhnetty.util.testjinzhengclient;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;

public class CheckClientInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        socketChannel.pipeline().addLast(new IdleStateHandler(90, 0, 0, TimeUnit.SECONDS));
        socketChannel.pipeline().addLast(new ByteArrayDecoder());
        socketChannel.pipeline().addLast(new ByteArrayEncoder());
        //登录校验
        socketChannel.pipeline().addLast(new CheckClientHandler());
    }
}